<template>
  <div class="container" @click="closeGallary">
    <div class="wrapper">
      <swiper :options="swiperOption">
        <!-- slides -->
        <swiper-slide>
          <img class="gallary-img" src="/static/images/detail/banner/ia_300000000.jpg" alt="">
        </swiper-slide>
        <swiper-slide>
          <img class="gallary-img" src="/static/images/detail/banner/ia_300000001.jpg" alt="">
        </swiper-slide>
        <!-- Optional controls -->
        <div class="swiper-pagination" slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>

<script>
  export default {
    name: 'Gallary',
    data (){
      return {
        swiperOption: {
          // 设置轮播图下方控制图标
          pagination: '.swiper-pagination',
          // 将控制图标改成分数 1/2 形式
          paginationType: 'fraction',
          // 从详情页点击图片进入图片画廊时，swiper效果失败，需要添加如下两个设置，实现进入时刷新
          observeParents: true,
          observer: true
        }
      }
    },
    methods: {
      closeGallary (){
        this.$emit('closeGallary')
      }
    }
  }
</script>

<style lang="stylus" scoped>
  .container >>> .swiper-container
    overflow: inherit
  .container
    display: flex
    flex-direction: column
    justify-content: center
    position: fixed
    left: 0
    right: 0
    top: 0
    bottom: 0
    background: #000
    z-index: 99
    .wrapper
      width: 100%
      height: 0
      padding-bottom: 100%
      .gallary-img
        width: 100%
      .swiper-pagination
        color: #fff
        bottom: -4rem
</style>
